﻿using Ay.Framework.WPF.Controls;
using Ay.MvcFramework.Wpf; 
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Ay.Framework.WPF;

namespace Hotel.UI.Views
{
    /// <summary>
    /// ChangeHeaderIcon.xaml 的交互逻辑
    /// </summary>
    public partial class ChangeHeaderIcon : AyWindow
    {
        public ChangeHeaderIcon()
        {
            InitializeComponent();
            AyExtension.SetAyWindowMouseLeftButtonMove(this);



            ObservableCollection<AyImageListItemFromByte> observableCollection = new ObservableCollection<AyImageListItemFromByte>();
            string str = System.IO.Path.Combine(AyuiConfig.ApplicationDirectory, "Contents/Images/DemoImage/");
            foreach (string str1 in new List<string>()
            {
                string.Concat(str, "44307-106.jpg"),
                string.Concat(str, "21313-106.jpg"),
                string.Concat(str, "98913-106.jpg"),
                string.Concat(str, "17166-106.jpg"),
                string.Concat(str, "331529-106.jpg"),
                string.Concat(str, "47494-106.jpg"),
                string.Concat(str, "42197-106.jpg"),
                string.Concat(str, "99138-106.jpg"),
                string.Concat(str, "122043-106.jpg"),
                string.Concat(str, "278659-106.jpg")
            })
            {
                AyImageListItemFromByte ayImageListItemFromByte = new AyImageListItemFromByte();
                ayImageListItemFromByte.ImageByte = ImageResources.GetImageByteByUri(str1);
                ayImageListItemFromByte.FileName = AyCommon.GetGuidNoSplit;
                if (str1 == string.Concat(str, "44307-106.jpg"))
                {
                    //ayImageListItemFromByte.FileName;
                }
                observableCollection.Add(ayImageListItemFromByte);
            }
            this.ImageListlBrowser.ItemsSource = observableCollection;


           


            //this.ImagePreview.Source = ImageResources.GetBitmapByUri((this.ImageListlBrowser.SelectedItem as AyImageListItemFromByte).FileName);
            //AyMessageBox.Show((this.ImageListlBrowser.SelectedItem as AyImageListItemFromByte).FileName);
        }

        private void ButtonSelectImage_Click(object sender, RoutedEventArgs e)
        {

        }

        private void buttonSelectImage_OnSelected(object sender, RoutedEventArgs e)
        {
            try
            {
                BitmapImage bitmapByUri = ImageResources.GetBitmapByUri(sender.ToString());
                //this.imageBrush_0.ImageSource = bitmapByUri;
                this.ImagePreview.Source = bitmapByUri;
            }
            catch (System.Exception ex)
            {
               
            }
        }
    }
}
